package util;
import java.sql.DriverManager;
import java.sql.Statement;
//import java.sql.Connection;



public class MyConnection {

	static final String DB_URL = "jdbc:mysql://localhost:3306/encrypt";
	static final String USER = "root";
	static final String PASS = "";
	
//	static final String DB_URL = "jdbc:mysql:/localhost:3306/milanrishta";
//	static final String USER = "milanrishta";
//	static final String PASS = "milanrishta@123";

	
	public static Statement getStatement(){
		Statement s=null;
		java.sql.Connection con=null;
		try{
			Class.forName("com.mysql.jdbc.Driver");
//			Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/encrypt user=root&password=''");
			con =DriverManager.getConnection(DB_URL,USER,PASS);
		s = con.createStatement();
		System.out.println("Statement : :::: "+s);
		}catch(Exception ex){
			ex.printStackTrace();
		}
		return s;
	}
	
	public static java.sql.Connection getConnection(){
		java.sql.Connection con=null;
		try{
			
			Class.forName("com.mysql.jdbc.Driver");
			con =DriverManager.getConnection(DB_URL,USER,PASS);
		 System.out.println("Test 3");
		System.out.println("Connection : :::: "+con);
		}catch(Exception ex){
			ex.printStackTrace();
		}
		return con;
	}
	
}
